import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

// vuex 数据持久化  存储localstorage
// import createPersistedState from "vuex-persistedstate"
import createPersistedState from "vuex-persistedstate";

export default new Vuex.Store({
  plugins:[createPersistedState()],  
  state: {
    cartname:8,
    userInfo:null,
    city:null,//当前的城市信息
    cityList:[]
  },
  mutations: {
    // 设置个全局混用
    changeCityList(state,payload){
      state.cityList = payload
    },
    changeUserInfo(state,payload){
      state.userInfo = payload
    },
    changeCity(state,payload){
      state.city=payload
    }
  },
  actions: {
  },
  modules: {
  }
})
